<?php

namespace App\Admin\Extensions\Tools;

use Dcat\Admin\Grid\BatchAction;
use Illuminate\Http\Request;
use App\Models\Device;

class PrintButton extends BatchAction
{
    protected $title = '打印标签';


    // 确认弹窗信息
    public function confirm()
    {
        return '您确认要打印这些标签吗';
    }

    // 处理请求
    public function handle(Request $request)
{
    $ids = $this->getKey();
    $url = admin_url("device/print-labels?ids=" . implode(',', $ids));
    return $this->response()->script("window.open('{$url}')");
}

    
}